package org.annoflow.policy;

import java.util.HashMap;

import org.annoflow.policy.boundry.SecureClassPolicy;

public class UserInputPolicy implements PolicyType {
	private static final String assessCheck = "target";
	
	@Override
	public void assess(HashMap<String, String> context) throws Exception {
		if ("html".equals(context.get(assessCheck))) {
			throw new Exception();
		}
		if ("sql".equals(context.get(assessCheck))) {
			throw new Exception();
		}
	}

	@Override
	public boolean audit(Object o, String filterName, Class<?> methodOwner) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public PolicyType generateOrigin() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getPolicyCode() {
		return "org.annoflow.policy.UserInputPolicy.addPolicy($class);";
	}
	
	public static void addPolicy(Class<?> clazz)
	{
		PolicyManager.addClassPolicy(clazz, new UserInputPolicy());
	}

}
